// Kony

#pragma once

#include "CoreMinimal.h"
#include "Character/BaseCharacter.h"
#include "Interaction/EnemyInterface.h"
#include "Interaction/TargetInterface.h"
#include "UI/WidgetController/OverlayWidgetController.h"
#include "EnemyCharacter.generated.h"

class UBehaviorTree;
class ABaseAIController;
class UTargetLockComponent;

/**
 * 怪物角色类
 */
UCLASS()
class GASC_HUANLING_API AEnemyCharacter : public ABaseCharacter, public IEnemyInterface, public ITargetInterface
{
	GENERATED_BODY()
public:
	AEnemyCharacter();
	//重写服务端执行函数
	virtual void PossessedBy(AController* NewController) override;

	/** Target Interface 目标接口 */
	virtual void HighlightActor_Implementation() override; //重写接口抽象类 设置高亮
	virtual void UnHighlightActor_Implementation() override; //重写接口抽象类 取消高亮
	virtual void SetMoveToLocation_Implementation(FVector& OutDestination) override; //重写缓存目的地接口
	/** end Target Interface */

	/** Combat Interface 敌人战斗接口 */
	virtual int32 GetPlayerLevel_Implementation() override;
	virtual void Die(const FVector& DeathImpulse) override;
	//设置战斗目标
	virtual void SetCombatTarget_Implementation(AActor* InCombatTarget) override;
	virtual AActor* GetCombatTarget_Implementation() const override;
	/** end Combat Interface */

	//引用覆盖层的广播来 广播血条变化
	UPROPERTY(BlueprintAssignable)
	FOnAttributeChangedSignature OnHealthChanged;
	UPROPERTY(BlueprintAssignable)
	FOnAttributeChangedSignature OnMaxHealthChanged;

	//当游戏标签变化时 调用此函数
	void HitReactTagChanged(const FGameplayTag CallbackTag, int32 NewCount);



protected:
	virtual void BeginPlay() override;
	//继承自父类 初始化能力系统 用于获取AbilitySystemComponent
	virtual void InitAbilityActorInfo() override;
	//重写父类的初始化默认属性
	virtual void InitializeDefaultAttributes() const override;

	//重写眩晕标签更变函数
	virtual void StunTagChanged(const FGameplayTag CallbackTag, int32 NewCount) override;
	//重写击倒标签更变函数
	virtual void DownTagChanged(const FGameplayTag CallbackTag, int32 NewCount) override;
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Character Class Defaults")
	int32 Level = 1;
	//行为树
	UPROPERTY(EditAnywhere, Category = "AI")
	TObjectPtr<UBehaviorTree> BehaviorTree;
	//AI控制器
	UPROPERTY()
	TObjectPtr<ABaseAIController> BaseAIController;


	
	
};
